package com.community.system.service.impl;

import java.util.List;
import com.community.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.community.system.mapper.PatrolCategoryMapper;
import com.community.system.domain.PatrolCategory;
import com.community.system.service.IPatrolCategoryService;

/**
 * categoryService业务层处理
 * 
 * @author ruoyi
 * @date 2025-10-27
 */
@Service
public class PatrolCategoryServiceImpl implements IPatrolCategoryService 
{
    @Autowired
    private PatrolCategoryMapper patrolCategoryMapper;

    /**
     * 查询category
     * 
     * @param categoryId category主键
     * @return category
     */
    @Override
    public PatrolCategory selectPatrolCategoryByCategoryId(Long categoryId)
    {
        return patrolCategoryMapper.selectPatrolCategoryByCategoryId(categoryId);
    }

    /**
     * 查询category列表
     * 
     * @param patrolCategory category
     * @return category
     */
    @Override
    public List<PatrolCategory> selectPatrolCategoryList(PatrolCategory patrolCategory)
    {
        return patrolCategoryMapper.selectPatrolCategoryList(patrolCategory);
    }

    /**
     * 新增category
     * 
     * @param patrolCategory category
     * @return 结果
     */
    @Override
    public int insertPatrolCategory(PatrolCategory patrolCategory)
    {
        patrolCategory.setCreateTime(DateUtils.getNowDate());
        return patrolCategoryMapper.insertPatrolCategory(patrolCategory);
    }

    /**
     * 修改category
     * 
     * @param patrolCategory category
     * @return 结果
     */
    @Override
    public int updatePatrolCategory(PatrolCategory patrolCategory)
    {
        patrolCategory.setUpdateTime(DateUtils.getNowDate());
        return patrolCategoryMapper.updatePatrolCategory(patrolCategory);
    }

    /**
     * 批量删除category
     * 
     * @param categoryIds 需要删除的category主键
     * @return 结果
     */
    @Override
    public int deletePatrolCategoryByCategoryIds(Long[] categoryIds)
    {
        return patrolCategoryMapper.deletePatrolCategoryByCategoryIds(categoryIds);
    }

    /**
     * 删除category信息
     * 
     * @param categoryId category主键
     * @return 结果
     */
    @Override
    public int deletePatrolCategoryByCategoryId(Long categoryId)
    {
        return patrolCategoryMapper.deletePatrolCategoryByCategoryId(categoryId);
    }
}
